﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
namespace EzFrameWork
{
    public class EzInputManager : Singleton<EzMonoManager>
    {
        public static void InputKeyDown(KeyCode key, UnityAction action)
        {
            EzMonoManager.Instance.AddUpDateListener(() =>
            {
                if (Input.GetKeyDown(key))
                {
                    action();
                }
            });
        }

        public static void InputKey(KeyCode key, UnityAction action)
        {
            EzMonoManager.Instance.AddUpDateListener(() =>
            {
                if (Input.GetKey(key))
                {
                    action();
                }
            });
        }

        public static void InputKeyUp(KeyCode key, UnityAction action)
        {
            EzMonoManager.Instance.AddUpDateListener(() =>
            {
                if (Input.GetKeyUp(key))
                {
                    action();
                }
            });
        }

        public static void InputGetMouseButtonDown(int button, UnityAction action)
        {
            EzMonoManager.Instance.AddUpDateListener(() =>
            {
                if (Input.GetMouseButtonDown(button))
                {
                    action();
                }
            });
        }

        public static void InputGetMouseButton(int button, UnityAction action)
        {
            EzMonoManager.Instance.AddUpDateListener(() =>
            {
                if (Input.GetMouseButton(button))
                {
                    action();
                }
            });
        }

        public static void InputGetMouseButtonUp(int button, UnityAction action)
        {
            EzMonoManager.Instance.AddUpDateListener(() =>
            {
                if (Input.GetMouseButtonUp(button))
                {
                    action();
                }
            });
        }
    }
}
